package com.api.ittools.entity;

import com.sun.org.apache.xpath.internal.operations.Bool;
import com.xcdh.commons.utils.StringUtil;
import com.xcdh.commons.utils.TypeMap;
import lombok.Data;
import org.apache.commons.lang3.text.WordUtils;

@Data
public class TablesColumn {
    private String columnName ;
    private String dataBaseName ;
    private String tableName ;
    private String dataType ;
    private String columnType ;
    private String comment ;
    private Boolean pk  ;

    private String extra ;
    private Boolean mapUnderscoreToCamelCase = true ;

    public Boolean isPrimary(){
        return pk ;
    }
    public String getFieldName(){
        if(mapUnderscoreToCamelCase){
            return StringUtil.toHump(columnName) ;
        }else {
            return columnName ;
        }
    }
    public String getJavaType(){
        return TypeMap.getJavaType(dataType) ;
    }
}
